home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-02 | 2.6 KB | 87 lines | [TEXT/CWIE] |
- /************************************************************************
- ***** File : Utilities.cp *****
- ***** Copyright 1996, Thomas R. Kimpton *****
- ***** All Rights Reserved *****
- ***** *****
- ***** This source code may be freely used in any programming *****
- ***** project so long as credit is duly noted of the author. *****
- ************************************************************************/
- #include "Utilities.h"
-
- //• --------------------------------------------------------------- •//
- void ShadowBox (Rect someRect) //• Receive rect to be done.
- {
- short width = (someRect.right - someRect.left) + 2; // Because we inset it below...
- short height = (someRect.bottom - someRect.top) + 2; // Because we inset it below...
-
- EraseRect (&someRect); //• Clean out the in'ards.
- InsetRect (&someRect, -1, -1); //• Expand it by 1, all sides.
- SetForeColor (0, 0, 0); //• black...
- FrameRect (&someRect); //• ...frame it.
- SetForeColor (0x4444, 0x4444, 0x4444); //• Using 2/3 gray...
- MoveTo(someRect.left,someRect.bottom);
- Line(width,0);
- Line(0,-height);
- SetForeColor (0x8888, 0x8888, 0x8888); //• Using 1/3 gray...
- MoveTo(someRect.left+1,someRect.bottom+1);
- Line(width,0);
- Line(0,-height);
- }
-
- void SetForeColor(short red, short green, short blue)
- {
- RGBColor hue;
-
- hue.red = red;
- hue.green = green;
- hue.blue = blue;
-
- RGBForeColor (&hue);
- }
-
- //• --------------------------------------------------------------- •//
- void SetBackColor(short red, short green, short blue)
- {
- RGBColor hue;
-
- hue.red = red;
- hue.green = green;
- hue.blue = blue;
-
- RGBBackColor (&hue);
- }
-
- /************************************************************************
- ***** Get the state of the handle, lock it and return the state. *****
- ************************************************************************/
- char
- HLockState(Handle theHndl)
- {
- char oldState;
-
- oldState = HGetState(theHndl);
- HLock(theHndl);
- return(oldState);
- } /* HLockState() */
-
- /************************************************************************
- ***** thisLoc is a point in some device's screen rect, iterate *****
- ***** through the screen device list and find and return the *****
- ***** portRect. If thisLoc isn't on any screen, return false. *****
- ************************************************************************/
- Boolean
- GetPortRectForThisPoint(Point thisLoc,Rect *thePortRect)
- {
- GDHandle gdNthDevice;
-
- gdNthDevice = GetDeviceList();
- while(gdNthDevice){
- if(PtInRect(thisLoc,&(**gdNthDevice).gdRect)){
- *thePortRect = (**gdNthDevice).gdRect;
- return(true);
- }
- gdNthDevice = GetNextDevice(gdNthDevice);
- }
- return(false);
- }
-